package com.allen.imsystem.user.model.pojo;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;

@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="User对象", description="用户")
public class User implements Serializable {

    private static final long serialVersionUID=1L;

    @TableId(value = "uid", type = IdType.NONE)
    @ApiModelProperty(value = "账号，系统分配，8位纯数字")
    private String uid;

    @ApiModelProperty(value = "哈希加盐密码")
    private String password;

    @ApiModelProperty(value = "用于密码加密的盐值")
    private String salt;

    @ApiModelProperty(value = "用户邮箱，可扩展邮箱登录")
    private String email;

    @ApiModelProperty(value = "手机号，可扩展手机号登录")
    private String tel;

    @ApiModelProperty(value = "用户角色id，可扩展权限系统，0->用户，1->管理员")
    private Integer roleId;

    @ApiModelProperty(value = "用户状态 1->有效， 0->无效")
    private Boolean status;

    @ApiModelProperty(value = "创建时间，在此表相当于注册时间")
    @TableField(fill = FieldFill.INSERT)
    private Date createdTime;

    @ApiModelProperty(value = "最后一次修改时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;

    public User() {
    }

    public User(String uid, String password, String salt, String email) {
        this.uid = uid;
        this.password = password;
        this.salt = salt;
        this.email = email;
    }

    public User(String password, String salt, String email, Date updateTime) {
        this.password = password;
        this.salt = salt;
        this.email = email;
        this.updateTime = updateTime;
    }
}
